/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.mappingmodel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import uimigration.mappingmodel.MappingBehaviourEvent;
import uimigration.mappingmodel.MappingmodelPackage;
import uimigration.mappingmodel.WidgetEvent;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Mapping Behaviour Event</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link uimigration.mappingmodel.impl.MappingBehaviourEventImpl#getMappedEvent <em>Mapped Event</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MappingBehaviourEventImpl extends EObjectImpl implements
		MappingBehaviourEvent {
	/**
	 * The cached value of the '{@link #getMappedEvent() <em>Mapped Event</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMappedEvent()
	 * @generated
	 * @ordered
	 */
	protected EList<WidgetEvent> mappedEvent;
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MappingBehaviourEventImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MappingmodelPackage.Literals.MAPPING_BEHAVIOUR_EVENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<WidgetEvent> getMappedEvent() {
		if (mappedEvent == null) {
			mappedEvent = new EObjectContainmentEList<WidgetEvent>(WidgetEvent.class, this, MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT);
		}
		return mappedEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT:
				return ((InternalEList<?>)getMappedEvent()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT:
				return getMappedEvent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT:
				getMappedEvent().clear();
				getMappedEvent().addAll((Collection<? extends WidgetEvent>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT:
				getMappedEvent().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT__MAPPED_EVENT:
				return mappedEvent != null && !mappedEvent.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //MappingBehaviourEventImpl
